package com.xuecheng.content.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xuecheng.content.model.dto.TeachplanDto;
import com.xuecheng.content.model.po.Teachplan;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 课程计划 Mapper 接口
 * </p>
 *
 * @author itcast
 */
public interface TeachplanMapper extends BaseMapper<Teachplan> {

    /**
     * 根据课程id查询
     * @param courseId
     * @return
     */
    List<TeachplanDto> selectTreeNodesByCourseId(Long courseId);


    /**
     * 通过课程id和排序查找课程计划
     * @param moveOrderby
     * @param courseId
     * @param teachplanId
     * @return
     */
    @Select("select * from teachplan where course_id=#{courseId} and orderby=#{moveOrderby}  and grade=#{grade} and parentid=#{techplanId}")
    Teachplan selectByCourseIdAndOrderby(@Param("moveOrderby") int moveOrderby,@Param("grade") int grade, @Param("courseId") Long courseId, @Param("techplanId") Long teachplanId);




}
